/**
 * Project Name : APP
 * File Name : DealController.java
 * Package Name : cn.weixin.interceptor.controller
 * Date : 2015-3-4下午5:00:36
 */
package cn.weixin.controller;

import java.io.IOException;
import java.io.InputStream;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.weixin.service.core.CoreService;

/**
 * ClassName : DealController Use : TODO. date : 2015-3-4 下午5:00:36
 * 
 * @author Han
 * @version
 * @since JDK 1.7
 */
@Controller
@RequestMapping("/test")
public class TestController {
	private static Logger log = LoggerFactory.getLogger(TestController.class);
	
	@Autowired
	private CoreService coreService;
	

	/**
	 * 用于修改配置
	 * 
	 * @param request
	 * @param response
	 * @throws IOException 
	 */
	@RequestMapping(value="t1",method = RequestMethod.GET)
	@ResponseBody
	public void excuteCheck(HttpServletRequest request, HttpServletResponse response) throws IOException {
		Cookie cookie = new Cookie("a", "asd");
		request.getSession(true).setAttribute("asd", "xx");
		response.addCookie(cookie);
		response.getWriter().write("呵呵");
	}
	@RequestMapping(value="t2",method = RequestMethod.GET)
	@ResponseBody
	public void excuteCheck2(HttpServletRequest request, HttpServletResponse response) {
		Cookie [] cookies = request.getCookies();
		for(Cookie cookie:cookies){
			System.out.println(cookie.getName()+","+cookie.getValue());
		}
	}
}
